__author__ = "liwen"
__time__ = "下午5:20"
from pydantic import BaseModel, Field
from typing import Optional, List
from enum import Enum
from datetime import date

class CityInfo(BaseModel):
    province : str
    country: str
    is_affected: Optional[bool] = None

class CityName(str, Enum):
    Beijing = "Beijing China"
    Shanghai = "Shanghai China"

class CityInfo2(BaseModel):
    name: str = Field(..., example="Beijing")
    province: str
    country_code: str = None
    country_population: int = Field(default=800,title="人口数量", le=800)

    class Config:
        schema_extra ={
            "example":{
                "name": "shanghai",
                "country": "china",
                "country_code": "CN",
                "country_population": 123000,
            }
        }

class Data(BaseModel):
    city :List[CityInfo2] = None
    date : date
    confirmed: int = Field(ge=0, description="确诊数", default=0)
    deaths :int = Field(ge=0, description="死亡数", default=0)
    recovered : int = Field(ge=0, description="痊愈数", default=0)